//
//  DDVisitorView.swift
//  SinaWeibo
//
//  Created by mac on 16/1/11.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

import SnapKit
class DDVisitorView: UIView {
    override init(frame: CGRect) {
      super.init(frame: frame)
        //添加子视图
        addSubview(circleIcon)
        //为了遮住圈圈
        addSubview(backView)
        addSubview(largeHouse)
        addSubview(tipLabel)
        addSubview(loginBtn)
        addSubview(registerBtn)
        
        
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
  
    

    override func layoutSubviews() {
        circleIcon.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(self.snp_centerX)
            make.centerY.equalTo(self.snp_centerY).offset(-80)
            }
        largeHouse.snp_makeConstraints { (make) -> Void in
            make.center.equalTo(circleIcon.center)
            
        }
        tipLabel.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(largeHouse.snp_centerX)
            make.centerY.equalTo(largeHouse.snp_centerY).offset(60)
            
        }
        loginBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(tipLabel.snp_left)
            make.top.equalTo(tipLabel.snp_bottom).offset(50)
            
        }
       registerBtn.snp_makeConstraints { (make) -> Void in
            make.right.equalTo(tipLabel.snp_right)
            make.top.equalTo(tipLabel.snp_bottom).offset(50)
            
        }
        backView.snp_makeConstraints { (make) -> Void in
            //            make.top.equalTo(self.snp_top)
            //            make.left.equalTo(self.snp_left)
            //            make.right.equalTo(self.snp_right)
            //和Masory 类似 支持链式设置约束的方式
            make.top.left.right.equalTo(self)
            make.bottom.equalTo(registerBtn.snp_bottom)
        }
        
    }
    
    
    
//懒加载获取所有的子视图
//背景
lazy var backView: UIImageView = UIImageView(image: UIImage(named: "visitordiscover_feed_mask_smallicon"))
//圈圈
lazy var circleIcon: UIImageView = UIImageView(image: UIImage(named: "visitordiscover_feed_image_smallicon"))
//大房子
lazy var largeHouse: UIImageView = UIImageView(image: UIImage(named: "visitordiscover_feed_image_house"))
    lazy var tipLabel : UILabel = {
        let lab = UILabel()
        
        lab.text = "登录后,别人评论你的微薄别人评论你的微薄别人评论你的微"
        lab.font = UIFont.systemFontOfSize(14)
        lab.textColor = UIColor.grayColor()
        lab.textAlignment = .Center
        lab.numberOfLines = 0
        lab.sizeToFit()
        return lab
        
        }()
    //登录按钮
    lazy var loginBtn: UIButton = {
        let btn = UIButton()
        //设置按钮的文字
        btn.setTitle("登录", forState: .Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(16)
        btn.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        btn.setBackgroundImage(UIImage(named: "common_button_white_disable"), forState: .Normal)
        return btn
        }()
    
    //注册按钮
    lazy var registerBtn: UIButton = {
        let btn = UIButton()
        //设置按钮的文字
        btn.setTitle("注册", forState: .Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(18)
        btn.setTitleColor(UIColor.orangeColor(), forState: .Normal)
      btn.setBackgroundImage(UIImage(named: "common_button_white_disable"), forState: UIControlState.Normal)
        
        
                return btn
        }()


}
